<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
  <el-menu mode="horizontal" @select="handleSelect">
    <el-menu-item v-for="c in arr" :index="c.id">{{c.name}}</el-menu-item>
  </el-menu>

</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
  let v = new Vue({
    el: '#app',
    data: function() {
      return {
        arr:[{id:1,name:"品牌男装"},
          {id:2,name:"精品女装"},
          {id:3,name:"数码科技"},
          {id:4,name:"医药健康"}]
      }
    },
    methods:{
      handleSelect(key,keyPath){
        //此方法不能直接输出数字，需要转成字符串
        v.$message("您点击分类的id="+key);
      }

    }
  })
</script>
</html>